#ifndef __KEY_H__
#define __KEY_H__

#include "main.h"
#include "stdint.h"
//=====================================================================================================

/*-----------------settings
--------------------------------------------------------
@brief:
*/

/*-----------------definitions
--------------------------------------------------------
@brief:
*/
#define KEY_PRESS 1
#define KEY_UNPRESS 0

//=====================================================================================================
/*-----------------params define
--------------------------------------------------------
@brief:
*/
typedef enum key_state {
  KEY_HOLD = 0x01,
  KEY_DOWN = 0x02,
  KEY_UP = 0x04,
} key_state_e;

typedef enum key_action {
  KEY_SINGLE,
  KEY_DOUBLE,
  KEY_LONG,
  KEY_REPEAT
} key_action_e;

typedef struct key {
  struct {
    uint16_t time;
    uint16_t count;
    key_state_e current_state;
    key_state_e previous_state;
    uint8_t flag;
    struct {
      GPIO_TypeDef *GPIOx;
      uint16_t GPIO_Pin;
    } key_gpio;
  } key_data;
  uint8_t single;
  uint8_t ;
} key_t;
/*-----------------functions
--------------------------------------------------------
@brief:
*/
//

/*-----------------others
--------------------------------------------------------
@brief:
*/
//

/*------------------------end-------------------------*/
#endif